Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / .github / workflows / pull-request-target.yml

Displaying Raw • Download

.github/workflows/pull-request-target.yml a11dee42a707b024033e16b802f014966aad0b89 (a11dee42) Text, 2.44 KB

Tff7b72nameTb4b4b4: Ta5d6ff"Ta5d6ffPullTe6edf3 Ta5d6ffRequestTe6edf3 Ta5d6ffLabelerTa5d6ff"
Tff7b72onTb4b4b4:
Tff7b72pull_request_targetTb4b4b4:
Tff7b72typesTb4b4b4: Tb4b4b4[Te6edf3openedTb4b4b4, Te6edf3synchronizeTb4b4b4]
T8b949e# Do not execute arbitrary code on this workflow.
T8b949e# See warnings at https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request_target

Tff7b72concurrencyTb4b4b4:
Tff7b72groupTb4b4b4: Ta5d6ff${{Ta5d6ff Ta5d6ffgithub.workflowTa5d6ff Ta5d6ff}}-${{Ta5d6ff Ta5d6ffgithub.event.pull_request.numberTa5d6ff Ta5d6ff}}
Tff7b72cancel-in-progressTb4b4b4: Ta5d6fftrue

Tff7b72jobsTb4b4b4:
Tff7b72labelerTb4b4b4:
Tff7b72permissionsTb4b4b4:
Tff7b72contentsTb4b4b4: Ta5d6ffread
Tff7b72pull-requestsTb4b4b4: Ta5d6ffwrite
Tff7b72runs-onTb4b4b4: Ta5d6ffubuntu-24.04-arm
Tff7b72stepsTb4b4b4:
Tb4b4b4- Tff7b72nameTb4b4b4: Ta5d6ffAuto-labelTa5d6ff Ta5d6ffPR
Tff7b72usesTb4b4b4: Ta5d6ffactions/github-script@v9
Tff7b72withTb4b4b4:
Tff7b72scriptTb4b4b4: Tb4b4b4|
Tff7b72const branch = context.payload.pull_request.head.ref;
Tff7b72const labels = new Set();

Tff7b72// enhancement: branch contains feat
Tff7b72if (/feat/i.test(branch)) labels.add('enhancement');

Tff7b72// bugfix: branch starts with fix or bug
Tff7b72if (/^(fix|bug)/i.test(branch)) labels.add('bugfix');

Tff7b72// refactor: branch starts with refactor
Tff7b72if (/^refactor/i.test(branch)) labels.add('refactor');

Tff7b72// repo: branch contains repo or ci
Tff7b72if (/repo|ci/i.test(branch)) {
Tff7b72labels.add('repo');
Tff7b72} else {
Tff7b72// Also label 'repo' if .github files were changed (needs one API call)
Tff7b72try {
Tff7b72const files = await github.paginate(
Tff7b72github.rest.pulls.listFiles,
Tff7b72{ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, per_page: 100 },
Tff7b72(res) => res.data.map(f => f.filename)
Tff7b72);
Tff7b72if (files.some(f => f.startsWith('.github/'))) labels.add('repo');
Tff7b72} catch (e) {
Tff7b72core.warning(`Could not list PR files (rate limited?): ${e.message}`);
Tff7b72}
Tff7b72}

Tff7b72if (labels.size > 0) {
Tff7b72const labelArray = [...labels];
Tff7b72core.info(`Applying labels: ${labelArray.join(', ')}`);
Tff7b72try {
Tff7b72await github.rest.issues.addLabels({
Tff7b72owner: context.repo.owner,
Tff7b72repo: context.repo.repo,
Tff7b72issue_number: context.payload.pull_request.number,
Tff7b72labels: labelArray,
Tff7b72});
Tff7b72} catch (e) {
Tff7b72core.warning(`Could not apply labels (rate limited?): ${e.message}`);
Tff7b72}
Tff7b72} else {
Tff7b72core.info('No labels matched for this PR.');
Tff7b72}

Served by rngit 1.5.2 - Generated in 0.03s